package com.example.yoho.mvp.view.activity;



import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.AppCompatActivity;

import com.example.yoho.R;
import com.example.yoho.mvp.view.adapter.MyViewPageAdapter;
import com.example.yoho.mvp.view.fragment.LoginFragment;
import com.example.yoho.mvp.view.fragment.RegisterFragment;
import com.example.yoho.utils.MyViewPage;

import java.util.ArrayList;
import java.util.List;

public class UserActivity extends AppCompatActivity {

    private MyViewPage myVwpg;
    private LoginFragment loginFragment=new LoginFragment();
    private RegisterFragment  registerFragment=new RegisterFragment();
    private MyViewPageAdapter adapter;
    private List<Fragment> list_fragment=new ArrayList<>();
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_user);
        initView();
    }

    private void initView() {
        myVwpg = (MyViewPage) findViewById(R.id.myVwpg);
        list_fragment.add(loginFragment);
        list_fragment.add(registerFragment);
        adapter=new MyViewPageAdapter(getSupportFragmentManager(),list_fragment);
        myVwpg.setAdapter(adapter);


    }

    public void ViewPages(int p){
        myVwpg.setCurrentItem(p);
    }
}
